////////////////////////////////////////////////////////////////////////////
//
//  Crytek Engine Source File.
//  Copyright (C), Crytek Studios, 2002.
// -------------------------------------------------------------------------
//  File name:   ISoundAssetManager.h
//  Version:     v1.00
//  Created:     26/4/2005 by Tomas.
//  Compilers:   Visual Studio.NET
//  Description: SoundAssetManager is responsible for memory allocation of
//							 assets and answer queries about their state and priority
// -------------------------------------------------------------------------
//  History:
//
////////////////////////////////////////////////////////////////////////////
#include DEVIRTUALIZE_HEADER_FIX(ISoundAssetManager.h)

#ifndef __ISOUNDASSETMANAGER_H__
#define __ISOUNDASSETMANAGER_H__

#pragma once

#include "SoundBuffer.h"
#include "VectorMap.h"
#include "CryName.h"

enum enumAssetManagerParamSemantics
{
	ampNONE
};

enum enumAssetManagerDrawInformation
{
	amdiALLBUFFERS,
	amdiONLYEVENTBUFFERS,
	amdiONLYSAMPLEBUFFERS
};

typedef VectorMap<CCryNameCRC, CSoundBufferPtr>				SoundBufferCRCMap;
typedef SoundBufferCRCMap::iterator										SoundBufferCRCMapItor;
typedef SoundBufferCRCMap::reverse_iterator						SoundBufferCRCMapRevItor;
typedef SoundBufferCRCMap::const_iterator							SoundBufferCRCMapItorConst;

typedef VectorMap<SSoundBufferProps, CCryNameCRC>			SoundBufferPropsDelayedMap;
typedef SoundBufferPropsDelayedMap::iterator					SoundBufferPropsDelayedMapItor;
typedef SoundBufferPropsDelayedMap::reverse_iterator	SoundBufferPropsDelayedMapRevItor;
typedef SoundBufferPropsDelayedMap::const_iterator		SoundBufferPropsDelayedMapItorConst;

struct IRenderer;


//////////////////////////////////////////////////////////////////////////////////////////////
// Sound Asset Manager Interface
//////////////////////////////////////////////////////////////////////////////////////////////
UNIQUE_IFACE struct ISoundAssetManager
{
	virtual ~ISoundAssetManager(){}
	//////////////////////////////////////////////////////////////////////////
	// Management
	//////////////////////////////////////////////////////////////////////////

	// frees all SoundBuffers, deletes all data;
	virtual bool					ShutDown() = 0;
	virtual void					Reset() = 0;

	// returns current Memory Usage
	virtual unsigned int	GetMemUsage() = 0;
	virtual void					GetMemoryUsage(class ICrySizer* pSizer) const = 0;		// compute memory-consumption, returns rough estimate in MB
	virtual unsigned int	GetNumberBuffersLoaded() = 0;

	// cleans up dead bufffers, defrags or kicks out low priority Buffers
	virtual bool					Update(bool const bIgnoreTimers = false) = 0;

	// writes output to screen in debug
	virtual void					DrawInformation(IRenderer* pRenderer, float xpos, float ypos, enumAssetManagerDrawInformation DrawMode) = 0;

	//////////////////////////////////////////////////////////////////////////
	// Buffer Management
	//////////////////////////////////////////////////////////////////////////


	// creates a SoundBuffer for a referred sound on a specific platform and returns the pointer to it
	virtual CSoundBuffer* CreateSoundBuffer(const SSoundBufferProps &BufferProps, CCryNameCRC const& rBufferCRC) = 0;

	// gets a sound buffer through its CRC key
	// checks and returns a Ptr to a Buffer or NULL if its not there
	virtual CSoundBuffer* const GetSoundBuffer(CCryNameCRC const& rBufferCRC) const = 0;

	// removes a SoundBuffer from the AssetManager
	virtual bool					RemoveSoundBufferCRC(CCryNameCRC const& rBufferCRC) = 0;

	// locks the SoundBuffers so they don't get unloaded
	virtual void					LockResources() = 0;

	// unlocks the SoundBuffers so they could be unload if needed
	virtual void					UnlockResources() = 0;

	// unloads ALL SoundBuffers
	virtual void					UnloadAllSoundBuffers() = 0;

	// removes project dependency
	virtual void					RemoveProjectDependency() = 0;

	// informs about project availability
	virtual void					ProjectWasLoaded(const ProjectIndex nProjectIndex) = 0;

	//////////////////////////////////////////////////////////////////////////
	// Asset Management
	//////////////////////////////////////////////////////////////////////////				

	//////////////////////////////////////////////////////////////////////////
	// Wavebank Management
	//////////////////////////////////////////////////////////////////////////

	// registers a wavebank name with full path 
	//virtual void CollectWaveBank(const char* sWaveBankName)

	//////////////////////////////////////////////////////////////////////////
	// Information
	//////////////////////////////////////////////////////////////////////////

	// Gets and Sets Parameter defined in the enumAssetParam list
	//virtual bool					GetParam(enumAssetManagerParamSemantics eSemantics, ptParam* pParam) = 0;
	//virtual bool					SetParam(enumAssetManagerParamSemantics eSemantics, ptParam* pParam) = 0;

};
#endif
